﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WebTraderLiteCL
{
    public class Stock
    {
        private string symbol;
        private string companyName;
        private float price;
        private int sharesOutstanding;
        private stockDataQuery qry = new stockDataQuery();

        //Constructor
        public Stock(string Sym)
        {
            Symbol = Sym.ToUpper();
            companyName = qry.getCompanyName(this.Symbol);
            sharesOutstanding = qry.getShareOutStanding(this.symbol);
        }//end if

        public Stock(string Sym, string company)
        {
            symbol= Sym.ToUpper();
            companyName = company.ToUpper();
        }

        public Stock(string sym, float pricex, int share)
        {
            this.symbol = sym;
            this.price = pricex;
            this.sharesOutstanding = share;
        }
        public float Price
        {
            get
            {
                price = qry.getCurrentPrice(this.Symbol); //always get most up to date price
                return price;
            }          
        }
        public string CompanyName
        {
            get{return companyName;}          
        }

        public string Symbol
        {
            get{return symbol;}
            private set{symbol = value;}
        }

        public int SharesOutstanding
        {
            get { return sharesOutstanding; }

        }



    }
}
